﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace Bit.Art.Db
{
    public static class DbInitializer
    {
        public const decimal INIT_BTC_BALANCE = 1 * 1000 * 1000;
        public const decimal INIT_USDT_BALANCE = 1 * 1000  * 1000 * 1000;

        public static void Intialize(ExchangeDb exchangeDb)
        {
            exchangeDb.Database.EnsureCreated();

            exchangeDb.AccountBalances.Add(new Core.Models.AccountBalance()
            {
                Id = Guid.NewGuid(),
                AccountId = 1,
                Balance = INIT_BTC_BALANCE, // 100万个BTC
                Currency = "BTC"
            });
            exchangeDb.AccountBalances.Add(new Core.Models.AccountBalance()
            {
                Id = Guid.NewGuid(),
                AccountId = 1,
                Balance = INIT_USDT_BALANCE, // 十亿USDT
                Currency = "USDT"
            });
            exchangeDb.AccountBalances.Add(new Core.Models.AccountBalance()
            {
                Id = Guid.NewGuid(),
                AccountId = 2,
                Balance = INIT_BTC_BALANCE, // 1万个BTC
                Currency = "BTC"
            });
            exchangeDb.AccountBalances.Add(new Core.Models.AccountBalance()
            {
                Id = Guid.NewGuid(),
                AccountId = 2,
                Balance = INIT_USDT_BALANCE, // 1百万USDT
                Currency = "USDT"
            });
            exchangeDb.SaveChanges();
        }
    }
}
